public class LinearSearch {
    public static <E> int search(E[] data, E target) {
        for (int i = 0; i < data.length; i++) {
            if (data[i].equals(target)) {
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        Integer[] data = {24, 18, 12, 9, 16, 66, 32, 4};
        System.out.println(LinearSearch.search(data, 16));
        Student[] students = new Student[]{new Student("Alice"),
                new Student("BoBo"),
                new Student("ZhangSan")};
        Student bo = new Student("BoBo");
        System.out.println(LinearSearch.search(students, bo));
    }
}
